package com.fenghongzhang.kotlin1903.mvvm

import io.reactivex.Observer
import io.reactivex.Scheduler
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

/**
 * 相当于mvp中的model
 * 用来读取远程数据或者本地的room
 */
object Repository {

    fun getFood(num:Int,oberver:Observer<Food>){
        RetrofitManager.create<FoodApi>()
            .getFood(num)
            .observeOn(AndroidSchedulers.mainThread())
            .subscribeOn(Schedulers.io())
            .subscribe(oberver)
    }

}
